package [package];

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.Environment;

import java.net.InetAddress;
import java.net.UnknownHostException;

/**
 * 程序入口
 * @author [author]
 */
@SpringBootApplication
@Slf4j
public class [project]Application {

    public static void main(String[] args) throws UnknownHostException {
        ConfigurableApplicationContext application = SpringApplication.run([project]Application.class, args);
        Environment env = application.getEnvironment();
        String ip = InetAddress.getLocalHost().getHostAddress();
        String port = env.getProperty("server.port") == null ? "8080" : env.getProperty("server.port");
        String contextPath = env.getProperty("server.servlet.context-path") == null ? "" : env.getProperty("server.servlet.context-path");
        log.info("\n----------------------------------------------------------\n\t" +
                "Application demo is running! Access URLs:\n\t" +
                "Local: \t\t\thttp://localhost:" + port + contextPath + "/\n\t" +
                "Druid 监控: \thttp://" + ip + ":" + port + contextPath + "/druid/index.html\n\t" +
                "----------------------------------------------------------");
    }

}
